package com.vcredit.creditcat.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.vcredit.creditcat.model.CustDimension;
import com.vcredit.creditcat.persistence.CustDimensionExtMapper;
import com.vcredit.creditcat.persistence.base.CustDimensionMapper;

/**
 * 
 **/
@Service
public class CustDimensionService {
	@Autowired
	private CustDimensionMapper mapper;
	@Autowired
	private CustDimensionExtMapper extMapper;

	public void insert(CustDimension obj) {
		mapper.insert(obj);
	}

	public void update(CustDimension obj) {
		mapper.update(obj);
	}

	public List<CustDimension> findAll() {
		return mapper.findAll();
	}

	public List<CustDimension> findByCustId(Long custId) {
		CustDimension obj = new CustDimension();
		obj.setCustId(custId);
		return find(obj);
	}

	private List<CustDimension> find(CustDimension obj) {
		return mapper.find(obj);
	}

	public List<CustDimension> find(Long custId, Long dimensionId) {
		CustDimension obj = new CustDimension();
		obj.setCustId(custId);
		obj.setDimensionId(dimensionId);
		return find(obj);
	}

	public void updateForDimension(CustDimension custDimension) {
		extMapper.updateForDimension(custDimension);
	}
}